﻿/**
 * 
 * Copyright 2009, 2010 Mike Jamer [email: mikejamer@gmail.com ]
 * 
 * This File is part of Moose IRC
 * 
 * MooseIRC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * MooseIRC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MooseIRC.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;

namespace moose.irc {
    /// <summary>
    /// IRC User /IRC User String parser
    /// </summary>
    [CLSCompliant(true)]
    public class IrcUser : IrcEntity {

        /// <summary>
        /// Initialize new IRC User
        /// </summary>
        /// <param name="user_string">User String</param>
        public IrcUser(string user_string)
            : base(user_string) {
            if (user_string.Contains("!") && user_string.Contains("@")) {
                string[] name_tok = user_string.Split(new char[] {
					'!',
					'@'
				}, StringSplitOptions.RemoveEmptyEntries);
                Nickname = name_tok[0];
                Username = name_tok[1];
                Hostname = name_tok[2];
            } else {
                Nickname = user_string;
            }

            return;
        }

        /// <summary>
        /// IRC Users Handle/NICKNAME
        /// </summary>
        public string Nickname { get; set; }

        /// <summary>
        /// IRC Users Registered Username
        /// </summary>
        public string Username { get; set; }

        /// <summary>
        /// IRC Users Registered Hostname
        /// </summary>
        public string Hostname { get; set; }

    }
}
